/**
 * Created by dell2 on 2016/11/4.
 */
var bcrypt = require('bcryptjs');
var salt = bcrypt.genSaltSync(10);

/**
 * 根据密码密文生成哈希
 */
exports.getBcryptHashStr = function(pass){
    return bcrypt.hashSync( pass ,salt );
}
/**
 * 使用密码密文与bcrypt校验
 */
exports.compareBcryptHashStr = function(pass,hash){
    return bcrypt.compareSync( pass , hash);
}


//test
// console.log("1d6010cd9dbd82777851c19ef1e2b70f==="+bcrypt.hashSync( "1d6010cd9dbd82777851c19ef1e2b70f",salt) ) ;
// console.log( bcrypt.hashSync( "1d6010cd9dbd82777851c19ef1e2b70f" ,salt ) ) ;
// console.log( bcrypt.compareSync("1d6010cd9dbd82777851c19ef1e2b70f", "$2a$10$eDZ0baVQKbmJm0U9aZzktOHMucgxR672X1D/NBtYlAxsmsMcntQgK")  ) ;
//console.log("$2y$05$rtsPxIkbsRf/oEC9B1.rP.DgRLiGSSiaBvIuW/qR2cP7LT9/Tfss." ) ;
//$2y$05$rtsPxIkbsRf/oEC9B1.rP.DgRLiGSSiaBvIuW/qR2cP7LT9/Tfss.

